home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Creative Review 28
/
Creative-Review-CD-ROM-28.iso
/
pc
/
kungfu
/
assets
/
game.dir
/
00044_Script_boss class
< prev
next >
Wrap
Text File
|
1997-08-08
|
5KB
|
231 lines
-- boss class method
-- --------------------------------------------------
property ancestor
property huntvector
property pattern
property patternindex
property patterncount
-- --------------------------------------------------
global gcell
global gplayer
global gfling
global gkeytomove
-- ==================================================
-- new method
-- --------------------------------------------------
on new me, props
minit me, props
return me
end mnew
-- ==================================================
-- minit method
-- --------------------------------------------------
on minit me, props
-- put "in minit boss"
setaprop props, #type, #boss
setaprop props, #health, 100
set pattern = getaprop ( props, #pattern )
set patternindex = 0
set patterncount = count ( pattern )
set ancestor = new ( script "enemy class" , props )
-- put "out minit boss"
end minit
-- ==================================================
-- mdispose me
-- --------------------------------------------------
on mdispose me
-- put "in mdispose boss class"
mdispose ancestor
set ancestor = 0
-- put "in mdispose boss class"
end mdispose me
-- ==================================================
-- mstart method
-- --------------------------------------------------
on mstart me
-- put "in start boss"
set the nextmove of me = 0
set the nextmoveflag of me = false
msetcurrentmove me, #idleleft
set the direction of me = #left
set the cell of me = 24
mbatchadd ( gcell, the cell of me, me)
set theloch = mcell2screen ( gcell , the cell of me )
set theloc = point ( theloch , mgetfloor ( gcell ) - 15 )
set offset = ( mgetstartoffset ( gcell, the direction of me, the data of me ) )
msetloc ( me, theloc + offset )
-- put "out start boss"
end mstart me
-- ==================================================
-- manimfinish method
-- --------------------------------------------------
on manimfinish me
-- put "in manimfinish boss "
mhide me
mmovefinish me
if (the nextmoveflag of me) then
set newmove = (the nextmove of me)
set the nextmoveflag of me = false
else set newmove = mthink ( me )
set newmove = mcheckwalk ( me, newmove)
set thekey = mmovetokey ( me, newmove )
-- put "boss move sound: " , the data of me, thekey
mmove gsound, the data of me, thekey
msetcurrentmove me, newmove
-- put "out manimfinish boss "
end manimfinish
-- ==================================================
-- mthink method
-- --------------------------------------------------
on mthink me
-- put "in mthink boss "
set newmove = mthink ( ancestor )
if ( newmove = 0 ) then
set patternindex = patternindex + 1
if patternindex > patterncount then set patternindex = 1
set action = getat ( pattern , patternindex )
-- put "action: " , action
case action of
#attack : set newmove = mattack ( me )
#hunt: set newmove = mkeytomove ( me , the direction of me )
#idle: set newmove = mkeytomove ( me, #idle )
end case
end if
-- put "newmove: " , newmove
-- put "out mthink boss "
return newmove
end mthink
-- ==================================================
-- mhit method
-- --------------------------------------------------
on mhit me, theloc
-- put "in mhit boss"
if ilk ( theloc, #point ) then
-- put "fling!", the currentmove of me
set props = [:]
set flingloc = ( the loc of me ) + theloc
setaprop props, #loc, flingloc
setaprop props, #cell, the cell of me
setaprop props, #direction, the direction of me
setaprop props, #data, the data of me
setaprop props, #move, the currentmove of me
mmake gfling props
else if theloc = 0 then
mdie ( me )
else if theloc = 1 then
mstream gsound , #dragondie
end if
-- put "out mhit boss"
end mhit
-- ==================================================
-- mdie method
-- --------------------------------------------------
on mdie me
-- put "in mdie boss"
mabort me
mdraw me
mbossdead gplayer
mreturnthedead gboss, me
-- mdispose me
-- put "out mdie boss"
end mdie
-- ==================================================
-- mhurt method
-- --------------------------------------------------
on mhurt me , attackmove, starloc
-- put "in mhurt boss"
set flag = mcheckhurt ( me , attackmove, starloc )
return flag
-- put "out mhurt boss"
end mhurt
-- ==================================================
-- mstartdie method
-- --------------------------------------------------
on mstartdie me
-- put "in mstartdie boss"
mstream gsound, the data of me
mbatchdelete gcell, the cell of me , me
-- put "out mstartdie boss"
end mstartdie